home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group98b.txt
/
000115_icon-group-sender _Mon Jun 29 16:24:34 1998.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
2KB
Return-Path: <icon-group-sender>
Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
by baskerville.CS.Arizona.EDU (8.8.8/8.8.7) with SMTP id QAA25642
for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Mon, 29 Jun 1998 16:24:34 -0700 (MST)
Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
id AA01832; Mon, 29 Jun 1998 16:24:22 -0700
From: Guy Laden <guy@math.tau.ac.il>
Message-Id: <199806291912.WAA25423@orion.math.tau.ac.il>
Subject: Re: Retrieving lists from tables
To: thomaspl@acm.org
Date: Mon, 29 Jun 1998 22:12:36 +0300 (GMT+0300)
Cc: icon-group@optima.CS.Arizona.EDU
In-Reply-To: <35970078.4332DA12@ix.netcom.com> from "Phillip Lee Thomas" at Jun 28, 98 10:48:24 pm
X-Mailer: ELM [version 2.4 PL25]
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Errors-To: icon-group-errors@optima.CS.Arizona.EDU
Status: RO
Content-Length: 943
> I'm working on a project where it would be most convenient to store
> information in a table where the index is a list and the value is a
> record; however, I find it not obvious how to retrieve the data as lists
> are retrieved by their ID number, not their value. Any suggestions?
>
> record ref(part1,part2)
> # Initially...
> t := table()
> L := ["house","horse"]
> t[L] := ref(1,2)
> # Later...
> L2 := ["house","horse"]
> Now I want to find out if a list with the content of L2 is in table t,
> and if so to augment the value of its part1.
I'd be happy to hear of solutions from experienced Icon programmers. My
solution in a similar case was to create a string out of the list and to
use it as key. I didn't have to handle arbitrary strings in my application
so encoding the list as a string was simple. Perhaps the codeobj module
from the IPL can be used if more generality is needed.
Regards,
Guy